<?php
/**
 * Created by PhpStorm.
 * User: sqq
 * Date: 2018/07/12
 * Time: 下午13:11
 */

class PublicApi{

    /**
     * @Author:      sqq
     * @DateTime:    2018-07-12 13:09:10
     * @Description: 判断城市（公用方法）
     * @return [1-城市开放] [2-城市未开放]
     */
    public static function Judge_city($city_name){
        //获取参数
        //$city_name = Input::get("city_name");
        if($city_name == ''){
            return json_encode(array('code' => 100010, 'msg' => '缺少参数city_name'));
        }
        $is_city = 0;  //未开放
        //判断城市是否开放
        $city = ResourceCityType::where("status",1)->where("name",$city_name)->select("id","name")->first();
        if(!is_null($city)){
            $is_city = $city->id;  //开放
        }
        return $is_city;
    }

}